package cn.my.quickSort;

public class QuickSort2 {
	public static void sort(int[] a, int low, int high){
		if (low < high) return;
		int i, j, index;
		i = low;
		j = high;
		index = a[i];
		while (i < j){
			while (i<j && a[j]>=index) j--;
			if (i < j) a[i++] = index;
			while (i<j && a[i]<index) i++;
			if (i < j) a[j--] = index;
		}
		a[i] = index;
		sort(a, low, i-1);
		sort(a, i+1, high);
	}
}
